package cn.lysoy.demo.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @Description
 * @Date 2022/9/3 15:11
 * @Created by lysoy
 */
@Mapper
public interface DynamicDatasourceTestMapper {
    @Select("SELECT name\n" +
            "        FROM region\n" +
            "        WHERE level = ${level}")
    List<String> regionNameList(@Param("level") int level);

    @Select("SELECT request_ip AS requestIp, COUNT(1) AS count FROM request_log GROUP BY requestIp")
    List<Map<String, Object>> countRequest();
}
